package com.powervision.mvvmdemo.ui.viewmodel

import com.powervision.base.base.BaseViewModel
import com.powervision.http.observer.StateLiveData
import com.powervision.mvvmdemo.ui.model.DataBean
import com.powervision.mvvmdemo.ui.repository.ArticleTopRepository

/**
 * @auth: njb
 * @date: 2021/12/21 12:44
 * @desc: 描述
 */
class ArticleTopViewModel :BaseViewModel(){
    private val mArticleTopRepository by lazy { ArticleTopRepository() }
    val mArticleTopLiveData = StateLiveData<List<DataBean>>()

    fun topArticle(){
        launchWithLoading(requestBlock = {
            mArticleTopRepository.top()
        }, resultCallback = {
            mArticleTopLiveData.value = it
        })
    }
}